$.fn.menubar = function(options){
	var caller = this;
	var options = options;
	
	var div = $(this);//.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
	var ul = $("> ul",  div);//.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");
	var lis = $('> li', ul);
	
	lis.each(function(index, node) {
		var li = $(this);
		/*
		li.mouseover(function() {
			lis.removeClass("ui-state-hover");
			li.addClass("ui-state-hover");
		}).mouseout(function() {
			lis.removeClass("ui-state-hover");
		}).click(function() {
			lis.removeClass("ui-tabs-selected ui-state-active");
			li.addClass("ui-tabs-selected ui-state-active");
		});*/
		
		$('> a', li).each(function(index, node){
			var a = $(this);
			if (a.next().length > 0) {
				var submenuNode = a.next();/*
				$("a", a.next()).each(function() {
					var suba = $(this);
					if (suba.attr('href') && suba.attr('href') !== '#') {
						this.setAttribute('onclick', '$("' + a.attr('href') + '").load("' + suba.attr('href') + 
							'");$("#' + div.attr('id')+'").tabs("select", "'+a.attr('href') + '");');
						this.setAttribute('href', '#');
					}
				});*/
				//Y.log(submenuNode.html());
				a.parent().menu($.extend(options, {
					content: '<ul '+(submenuNode.attr('id') ? 'id="' + +'" ': '') + '>' + submenuNode.html() + '</ul>'
				}));
				submenuNode.remove();
			}
		});
	});
	
	div.tabs(options);//.find(".ui-corner-bottom").removeClass("ui-tabs-panel ui-corner-bottom");
	
	return div;
};
